<script>
import GroupInfo from './components/GroupInfo.vue';
import GroupMembers from './components/GroupMembers.vue';
import GroupIntro from './components/GroupIntro.vue';
import GroupShow from './components/GroupShow.vue';
import GroupBenefits from './components/GroupBenefits.vue';
import GroupFAQ from './components/GroupFAQ.vue';
import GroupComments from './components/GroupComments.vue';
import FloatKefu from './components/FloatKefu.vue';
import PayButton from './components/PayButton.vue';
import GroupIcons from "@/views/group-page/components/GroupIcons.vue";
import {getAuthLink, getProjectInfo, getProjectInfoApi, getToken, visitorInfo} from "@/api";
import StorageUtil from "@/utils/storage";
import {URL} from "@/config/url";

export default {
    name: 'GroupPage',
    components: {
        GroupIcons,
        GroupInfo,
        GroupMembers,
        GroupIntro,
        GroupShow,
        GroupBenefits,
        GroupFAQ,
        GroupComments,
        FloatKefu,
        PayButton
    },
    data() {
        return {
            groupInfo: {
                img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/o3LMM0LK4235NJ349wLJHh84k3KMK7.png',
                title: '游戏开黑组局搭子群',
                desc: '一次付费永久更新，优质游戏开黑搭子群，人满后新群可以一直加，进无数个群，永久有效！'
            },
            members: [
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/FIIfMIijMrT7X2sfIffxiZfJJF7D2I.jpg',
                    name: '甜姬'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/ett5XQ0GGdB0uxOOgdObpDq2N66kKO.jpg',
                    name: '橘柚溪'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/c8DlClqs8j3OW0SdbSen11w6XzSaxD.jpg',
                    name: '送你归西'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/LDD3RWn8xkc4icNxAT5NwIOAXODXZW.jpg',
                    name: '情绪化'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/AiNc65vu5nVNQ4Dv216UUA44cUvd4B.jpg',
                    name: '桔味美人'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/oDa3v3J6a6h8cc7lsH3CSlD5D38vL5.jpg',
                    name: '头號玩家'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/X3K8k3ek5598wR5r9Ix8p3Vjjf83C8.jpg',
                    name: '失语症小兔'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/fpMHUlqfHCC8QqhJl4RX1bc2pMlrRL.jpg',
                    name: '迷人少女'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/xQqMBGYgzpDDFIppM1rFQGI6fk9Ymo.jpg',
                    name: '朵伊秋'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/Yd3YYUQTTOztTvzNUV4DutNtZQT99t.jpg',
                    name: '空客'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/N95e1zk11FPe221FKGP2fa5eppPppe.jpg',
                    name: '傀儡'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/X6OF4FuLSF6Sb6hpOKbdS4DfpPfdk4.jpg',
                    name: '甜味折耳猫'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/E6j51NJnPofN05j5X0nfMnNwTM7m7m.jpg',
                    name: '海纱画'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/Z6A56v0sTVTbnqDkVbFL5bo5StdK36.jpg',
                    name: '清绾'
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/defaultimgs/GEQiZebQ72kixq1F8QjKEEeXzeEKQ2.gif',
                    name: ''
                }
            ],
            intro: {
                text: '本群是王者荣耀、金铲铲、平精英游戏等开黑搭子群，一次付费永久进新群，进群都是真诚的，可以闲聊唠嗑，开黑组局，找到自己同频的开黑伙伴，群内24小时活跃',
                link: ''
            },
            show: {
                count: 96,
                img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/gUXKEv55hZ4i9ziIt5kI55rLMr9ti5.jpg',
                link: './index.php?i=31&c=entry&do=qunshow&m=y2_jiukuaijiu'
            },
            benefits: [
                {
                    title: '福利1.群内每天更新，各种各样的开黑好友..',
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/Ca6f2nfnZ2CDzW2632ciLDaBn2CCs4.jpg'
                },
                {
                    title: '福利2. 将会拥有优质人脉，年轻人的高端社群..',
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/rLr0BrwWG82zLLbWUzw0z2Rz0LRGLL.jpg'
                }
            ],
            faqs: [
                {
                    q: '1.付费后支持退款吗？',
                    a: '一旦付费，无论何种原因该不退款（包括违规被踢出群的），请谨慎选择，看好再买。群费不多不少，买个信任。做付费群，避免垃圾人，过滤人群，提升群质量。避免人多嘴杂，杜绝吃白食群众。付费入群更能让社群形成正向循环，是社群内容质量的保障。'
                }
            ],
            comments: [
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/FIIfMIijMrT7X2sfIffxiZfJJF7D2I.jpg',
                    name: '甜姬',
                    content: '离婚了，前夫联合小三一起报复我，净身出户还侵占了我所有财产和两个小孩，我已经做好了殊死一搏的准备，这一次，我一定要赢，来群里和我一起遨游王者峡谷，倾听我的复仇计划。',
                    likes: 6524
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/X3K8k3ek5598wR5r9Ix8p3Vjjf83C8.jpg',
                    name: '失语症小兔',
                    content: '老公欠了一屁股债房子卖了，还出轨，和酒吧的女人不清不楚，为了孩子我才维持着这段破裂的婚姻，终于我忍受不了离婚了孩子也被带走了 在群里想找个人打王者荣耀，最好是厉害点的，帅哥优先。',
                    likes: 4652
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/X6OF4FuLSF6Sb6hpOKbdS4DfpPfdk4.jpg',
                    name: '甜味折耳猫',
                    content: '老 ️公 不 ️在 ️家 ❤️一 个 人 寂 寞 ❤️ 火❤️ 热❤️ 劲❤️ 爆❤️ 游❤️ 戏❤️ 王者荣耀 激❣️情❣️上❣️分',
                    likes: 3453
                },
                {
                    img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/oDa3v3J6a6h8cc7lsH3CSlD5D38vL5.jpg',
                    name: '头號玩家',
                    content: '穿过挪威的森林，让我走进你的梦里，夕阳落在我的铠甲，王子不一定骑着白马，你不必故作冷淡，我也不想最后纠缠，最后问一次，打王者吗？群里找我！',
                    likes: 2213
                }
            ],
            kefu: {
                img: 'http://jiaoyou.dtjug.cn/attachment/images/31/2024/08/s756Rczs89W5S798y9tc55r9zrySNz.jpg',
                qr: require('@/assets/group/kefu.jpg')
            },
            pay: {
                price: '9.9',
                text: '限时￥9.9进群',
                payText: "已支付, 点击查看二维码",
                isPay: false
            },
            code: ''
        }
    },
    mounted() {
        // 设置项目id
        if (!this.$route.query.id) {
            alert('项目id不能为空')
            return
        }
        StorageUtil.setProjectId(this.$route.query.id)
        // 回掉地址
        const code = new URLSearchParams(window.location.search).get('code');
        this.code = code
        const token = StorageUtil.getToken()
        if (!token) {
            if (code) {
                const code = new URLSearchParams(window.location.search).get('code');
                getToken({code}).then(res => {
                    // 处理 token，例如存储到本地
                    console.log('获取 token 成功', res);
                    StorageUtil.setToken(res)
                }).catch(error => {
                    console.error(error)
                    console.error('获取 token 失败', error);
                });
            } else {
                getAuthLink({ url: URL + '?id=1' }).then(res => {
                    // 重定向到微信授权页面
                    window.location.href = res;
                }).catch(error => {
                    console.error('获取授权链接失败', error);
                });
            }
        }
        const projectId = StorageUtil.getProjectId()
        if (projectId && token) {
            this.getProjectInfo(projectId)
            this.getVisitorInfo()
        }
    },
    methods: {
        getProjectInfo(projectId) {
            if (projectId) {
                getProjectInfoApi(projectId).then(res => {
                    this.groupInfo.img = res.avatar
                    this.groupInfo.title = res.title
                    this.groupInfo.desc = res.remark
                })
                // res返回格式
                // {
                // avatar: "https://wx3.sinaimg.cn/mw690/88e90961ly1hwvqdknjo4j20u0140tav.jpg"
                // id: 1
                // remark: "测试项目描述"
                // title: "测试项目"
                // workerQrCode: "https://wx3.sinaimg.cn/mw690/88e90961ly1hwvqdknjo4j20u0140tav.jpg"
                // }
            }
        },
        getVisitorInfo() {
            const projectId = StorageUtil.getProjectId()
            visitorInfo().then(res => {
                this.pay.isPay = res.projects.includes(projectId)
            })
        }
    },
    unmounted() {
        this.code = ''
    }
}
</script>

<template>
    <div >
        <GroupInfo :info="groupInfo"/>
        <div class="qunz">
            <GroupMembers :members="members"/>
            <GroupIntro :intro="intro"/>
            <GroupShow :show="show"/>
            <GroupBenefits :benefits="benefits"/>
            <GroupFAQ :faqs="faqs"/>
            <div class="yuedu">阅读63.9万</div>
            <group-icons></group-icons>
        </div>
        <GroupComments :comments="comments"/>
        <PayButton :pay="pay"/>
        <FloatKefu :kefu="kefu"/>
    </div>
</template>

<style scoped lang="less">
p {
    padding: 0;
    margin: 0;
}

a {
    text-decoration: none;
}

body {
    margin: 0 !important;
    font-family: Arial;
}

.qun {
    width: 100%;
    margin: 0 auto;
    padding: 2.7rem 0;
    text-align: center;
    background-color: #f2f2f2;
    border-bottom: 0.1rem solid #c1c0c5;
}

.qun img {
    width: 5.42rem;
    height: 5.32rem;
    border-radius: 0.5rem;
    margin: 0 auto;
}

.qun .quntit {
    font-size: 1.4rem;
    color: #1d1d1d;
    margin-top: 0.85rem;
}

.qun .num {
    font-size: 1rem;
    color: #959595;
    margin-top: 0.67rem;
}

.qunz {
    //width: 100%;
    margin: 0 auto;
    background-color: #fff;
    padding: 0 1rem;
    padding-bottom: 1.64rem;
}

.title2 {
    font-size: 1.32rem;
    color: #1c1f31;
    margin-top: 0.96rem;
}

.title {
    font-size: 1.32rem;
    color: #1c1f31;
    margin-top: 0.96rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
}

.peoplez {
    display: flex;
    flex-wrap: wrap;
}

.peoplez .peoplef {
    margin-top: 1.14rem;
    width: 20%;
    display: flex;
    flex-direction: column;
}

.peoplez .peoplef img {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.5rem;
    margin: 0 auto;
}

.peoplez .peoplef p {
    font-size: 0.89rem;
    color: #aeaeae;
    width: 83%;
    margin: 0 auto;
    margin-top: 0.53rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.qunstate .qs {
    font-size: 1.1rem;
    line-height: 1.8rem;
    margin-top: 0.5rem;
}

.qunstate .qs a {
    color: #aeaeae;
}

.qunstate .qs p {
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 1.15rem;
    color: #7e7e7e;

}

.qunjianjie img {
    width: 90%;
    display: flex;
    justify-content: center;
    margin: 0 auto;
    height: 5.85rem;
    margin-top: 1.14rem;
}


.qunfuli p {
    font-size: 1.2rem;
    color: #7e7e7e;
    margin-top: 1rem;
    line-height: 1.6rem;
}

.qunfuli p span {
    color: #425887;
}

.qunfuli img {
    width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
}

.qunstate {
    font-size: 1.1rem;
}

.qunstate .question .ad {
    color: #425887;
    margin-top: 1rem;
}

.qunstate .question .aw {
    color: #7e7e7e;
    margin-top: 0.57rem;
}

.yuedu {
    font-size: 1.2rem;
    color: #b1b1b1;
    line-height: 4rem;
}

.qunicon {
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: #405683;
    justify-content: space-between;
    text-align: center;
}

.qunicon img {
    width: 1.3rem;
    height: 1.3rem;
}

.qunicon1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 36%;
}

.liuyanz .bg {
    width: 35%;
    height: auto;
    margin-left: 3.1rem;
    margin-top: 0.3rem;
}

.qunjishu {
    font-size: 0.9rem;
    margin-top: 0.71rem;
    text-align: center;
    margin-bottom: 10rem;
}

.qunjishu a {
    color: #425887;
}

.qunjishu2 {
    font-size: 1rem;
    margin-top: 0.8rem;
    text-align: center;
    margin-bottom: -0.7rem;
}

.qunjishu2 a {
    color: #425887;
}

.qunbtn {
    position: fixed;
    width: 90%;
    margin-left: 5%;
    font-size: 1.25rem;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    border-radius: 0.5rem;
    background-color: #425887;
    bottom: 0.4rem;
}

.qunbtn a {
    color: #fff;
}

.xuanfu {
    position: fixed;
    display: flex;
    flex-direction: column;
    bottom: 20%;
    right: 2%;
}

.xuanfu .kefu2 {
    margin-top: 0.53rem;
}

.liuyantit2 .back {
    width: 1.8rem;
    height: 1.8rem;
}

.qjieshao {
    padding: 0 5%;
    background-color: #fff;
    font-size: 1rem;
    line-height: 1.6rem;
    color: #000013;
    margin-top: 1.1rem;
}

.qjieshao .qjst {
    width: 100%;
    margin-top: 0.5rem;
}

/*order*/
.orderz {
    width: 96%;
    margin: 0 auto;
}

.order {
    background-color: #f2f2f2;
}

.ordernum {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    padding-bottom: 2.184rem;
    margin-top: 0.72rem;
    border-radius: 0.2rem;
}

.ordernum .img {
    width: 4.66rem;
    height: 4.66rem;
    margin: 0 auto;
    margin-top: 0.768rem;
    border-radius: 0.3rem;
}

.ordernum .p {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 1rem;
    color: #585656;
    margin-top: 0.936rem;
    text-align: center;
}

.ordernum .ordernumber {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.2rem;
}

.ordernum .p span {
    color: #425887;
}

.ordernum .p img {
    width: 0.852rem;
    height: 1.02rem;
    margin-left: 0.728rem;
    display: flex;
    align-self: center;
}

.fulistate {
    font-weight: bold;
    font-size: 1.078rem;
    color: #585656;
    margin-top: 0.852rem;
    margin-bottom: 0.684rem;
}

.fulistate span {
    color: #425887;
}

.orderfuli .ofuliz {
    background-color: #fff;
    border-radius: 0.2rem;
    padding: 0.684rem 0.42rem;
}

.ofuliz .fulitit {
    font-size: 0.984rem;
    color: #585656;
    background-color: #f9f8f8;
    padding: 0.552rem 0.6rem;
    margin-top: 0.684rem;
    border-radius: 0.1rem;
}

.orderfuli .ofuliz .qw {
    width: 11rem;
    height: 11rem;
    margin: 0 auto;
    margin-top: 1rem;
}

.ofuliz .qunma {
    width: 80%;
    height: auto;
    margin: 0 auto;
    margin-top: 1.452rem;
}

.orderfuli .ofuliz .pone {
    font-size: 0.936rem;
    color: #585656;
    margin-top: 0.552rem;
}

.ofuliz .erweim {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.ofuliz .fulibot {
    font-size: 0.936rem;
    color: #585656;
    margin-top: 0.984rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ofuliz .fulibot2 {
    display: flex;
    align-items: center;
    justify-content: left;
    margin-left: 0.6rem;
}

.ofuliz .fulibot span {
    color: #425887;
}

.ofuliz .fulibot img {
    width: 0.984rem;
    height: 0.984rem;
    margin-left: 0.12rem;
}

.orderfuli .xuan {
    width: 100%;
    height: auto;
    margin-top: 0.684rem;
}

.ofuliz .kefu3 {
    width: 11rem;
    height: 11rem;
    margin: 0 auto;
    margin-top: 1.2rem;
}

.orderfuli2 {
    margin-top: 1.2rem;
}

.qunicon1 .icon1 {
    display: flex;
    color: #405683;
}

.qunicon1 .icon1 span {
    margin: 0 0.5rem;
    white-space: nowrap;
}

.question p {
    font-size: 1.1rem;
}

/*order*/
.ordernumber span input {
    width: 9.5rem;
    border: none;
    color: #425887;
    font-size: 1rem;
}

.erweim .fulibot p span input {
    width: 5.5rem;
    border: none;
    color: #425887;
    font-size: 1rem;
}

.fulibot2 p span input {
    width: 15rem;
    border: none;
    color: #425887;
    font-size: 1rem;
}

.panlink p span input {
    width: 2.5rem;
    border: none;
    color: #425887;
    font-size: 1rem;
}

.phone2 {
    display: flex;
    align-self: center;
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-width: 320px;
    height: 100%;
    display: none;
}

.popz {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-width: 320px;
    height: 100%;
    background-color: rgba(88, 87, 86, 0.5);
}

.popup .popc {
    width: 70%;
    height: auto;
    position: absolute;
    left: 15%;
    top: 15%;
    border-radius: 1rem;
    float: left;
    background-color: #ffffff;
}

.popup .popc .bgone {
    width: 100%;
    height: 6.3rem;
    background-color: #ff2742;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.popup .popc .bgone span {
    position: relative;
    z-index: 999;
    top: 2.5rem;
    margin: 0 auto;
    color: #fff;
    font-size: 1.5rem;
}

.popup .close {
    margin-top: 1rem;
    position: fixed;
    width: 2.4rem;
    height: 2.4rem;
    margin-left: 30%;
}

.popup .popc .qw {
    position: relative;
    width: 10rem;
    height: 10rem;
    margin: 0 auto;
    display: block;
    margin-top: 1.5rem
}

.popup .popc span {
    position: relative;
    display: block;
    text-align: center;
}

.popup .popc p {
    position: relative;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666666;
    display: block;
    width: 12rem;
    line-height: 1.5rem;
    margin-left: 3rem;
    margin-bottom: 0.5rem;
}

.popup .popc .pp {
    width: 85%;
    margin: 0 auto;
    text-align: left;
    color: #1b1b1b;
    white-space: pre-wrap;
    line-height: 1.3rem;
    margin-bottom: 1rem;
}

.popup .popc .qw2 {
    margin-top: 1rem;
}

.popup .tel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 85%;
    margin: 0 auto;
    height: 2.5rem;
    line-height: 2.5rem;
    background-color: #ffe9ec;
    border-radius: 0.2rem;
    margin-bottom: 0.6rem;
    margin-top: 0.8rem;
}

.popup .tel img {
    width: 1rem;
    height: 1.1rem;
    margin-right: 0.5rem;
}

.popup .tel .tel2 {
    margin-left: 0.5rem;
}

.popup .tel a {
    text-decoration: none;
    color: #2c2c2b;
    font-size: 0.85rem;
    text-align: center;
    display: flex;
    align-self: center;
}

.xuanfu .kefu1, .kefu2 {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
}

/*top*/
.imgtop {
    width: 100%;
}

.imgtop img {
    width: 100%;
    height: auto;
}

.imgtop2 {
    width: 100%;
    border-top: 1px solid #f0f0f0;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.imgtop2 img {
    width: 100%;
    height: auto;
    margin-top: 1rem;
    margin-bottom: -1.3rem;

}

.title2, .peoplez, .title, .qs, .fuli, .question, .yuedu, .qunicon, .liuyantit, .liuyanz {
    width: 90%;
    margin: 0 auto;
}

.qunpeople .title2 {
    margin-top: 0.96rem;
}

.qunstate .qs a {
    text-decoration: none;
}

.qunfuli {
    margin-top: 1rem;
}

.ab img {
    width: 90%;
}

.ab p {
    width: 90%;
    margin: 0 auto;
}

.ab {
    padding-top: 2rem;
    padding-bottom: 5rem;
}
</style>
